/******************************************************************************************
 * Import
 ******************************************************************************************/

// module
import React, {Component} from 'react';
import {View, Dimensions, TextInput } from 'react-native';
import { Button, Toast, Icon } from 'antd-mobile-rn';

// project



import {
    CAround, CBetween, CCenter, CColumn, CHand, CItemX, CItemY, CLine, CRow, CWrap, 
    CIcon, CImage, CSvg, CText,
    CContent, CFloat, CFooter, CHeader, CPage, CSide, 
    CEmpty, CError, CFail, CSkeleton, 
    CLabel, CButton
} from '../../../../library/comp';

import Licon from '../../../../library/comp/project/icon';



/******************************************************************************************
 * Export Class
 ******************************************************************************************/

export default class UserSettingCarAdd extends Component {

    /*------------------------------------------------------------------------------------
	 * 初始化
	 *-----------------------------------------------------------------------------------*/
    constructor(props) {
        super(props);
        // this.Nav = this.props.navigation;

        /**
         * state
         */
        this.state = {
            carcode:"",
        };


    }



    submitInfo(){


        if(this.state.carcode == ""){
            Toast.info("请填写车牌号", 1);
            return;
        }

        // HttpTemp.post({

        //     url:"/CPage/mycar/logic/add.php",
        //     data:{
        //         set_number:this.state.carcode
        //     },
        //     success:(res) => {
        //         Toast.info("已成功添加", 1);
        //     },
        //     error: {
        //         code: (res)=> {
        //             Toast.info(res.msg, 1);
        //         }
        //     }

        // })
    }

    /*------------------------------------------------------------------------------------
	 * 渲染
	 *-----------------------------------------------------------------------------------*/
    render(){
        var windowWidth = Dimensions.get('window').width;
        return(
            <CPage>

                <CContent bg='rgba(248, 248, 248, 1)' mt='96'>

                    <View>

                        {/* 车辆信息标题 */}
                        <CItemX w="750" mx="30" h="80" y="center"> 
                            <CText color="#AEAEAE" size="26">车辆信息</CText>
                        </CItemX>
                        
                        <CItemY  w="750" bg="white" ra='8'>

                            {/* 车牌号码信息 */}
                            <CItemX w="750" px="30" style={{ borderBottomWidth:1, borderBottomColor:"#eee" }}  h="100" y="center"> 
                                <CBetween>
                                    <CText color="#434343" size="30">车牌号码</CText>
                                    <TextInput
                                        onChangeText={(val)=>{
                                            this.setState({
                                                carcode:val,
                                            })
                                        }}

                                        style={{  minWidth:150, textAlign:"right" }}
                                        defaultValue={ this.state.carcode }  
                                        clearTextOnFocus={true}
                                        placeholder="请输入车牌号码"
                                        placeholderTextColor="#c9c9c9"
                                        underlineColorAndroid="transparent"
                                    />
                                </CBetween>
                            </CItemX>

                        </CItemY>

                        {/* 保存按钮 star */}
                        <CRow pa='40' pt='72'>
                            <CHand ra='10' bg='#02b349' py='8' f='1' x='center' onPress={this.submitInfo.bind(this)}><CText color='#fff' size='32' style={{textAlign:'center'}} >添加</CText></CHand>
                        </CRow>
                        {/* 保存按钮 end */}

                    </View>
                    
                </CContent>

                {/* 顶部 star */}
                <CHeader h='96' y='center' bg='#fff' style={{ borderBottomColor:"#eee", borderBottomWidth:1 }}>
                    <CBetween px='20'>
                        <CHand onPress={(e)=> {
                            this.Nav.goBack()
                        }}>
                            <Icon type='left' size='md' color='#00CC66' />
                        </CHand>

                        <CText size='34'>添加车辆</CText>
                        <CHand w='44' h='44'></CHand>
                    </CBetween>
                </CHeader>
                {/* 顶部 star */}


            </CPage>
        )
    }
}

